import chinaGeoData from '@/static/map/china-d3-geo.js'

// 预加载地理数据
let geoData = null

export const getGeoData = () => {
  if (!geoData) {
    geoData = chinaGeoData
  }
  return geoData
}

// 获取省份数据
export const getProvinceData = (adcode) => {
  const data = getGeoData()
  return data.features.find(feature => feature.properties.adcode === adcode)
}

// 获取所有省份列表
export const getProvinceList = () => {
  const data = getGeoData()
  return data.features.map(feature => ({
    adcode: feature.properties.adcode,
    name: feature.properties.name,
    center: feature.properties.center
  }))
} 